/** 
* Copyright (C) 2012-2017 ZEEI Inc.All Rights Reserved.
* 项目名称：efs
* 文件名称：AlarmCodeController.java
* 包  名  称：com.zeei.efs.controller
* 文件描述：TODO 请修改文件描述
* 创建日期：2017年6月8日下午1:47:43
* 
* 修改历史
* 1.0 chenhuiqiong 2017年6月8日下午1:47:43 创建文件
*
*/


package com.zeei.app.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.zeei.app.service.MyCollectService;
import com.zeei.app.vo.MyCollectVO;
import com.zeei.common.annotation.SysLog;
import com.zeei.common.controller.BasicController;
import com.zeei.common.enums.LogType;
import com.zeei.common.utils.SessionInfoUtil;
import com.zeei.common.vo.PageParamVO;
import com.zeei.common.vo.ResultBasicVO;
import com.zeei.common.vo.ResultRowsVO;
import com.zeei.common.vo.UserVO;


/**
 * 
* @类型名称：MyCollectController
* @类型描述：收藏管理
* @功能描述：收藏管理
* @创建作者：chenhuiqiong
*
 */
@Controller
@RequestMapping("/app/collect")
public class MyCollectController extends BasicController{
	@Autowired
	private MyCollectService myCollectService;
	
	@RequestMapping(value = "/myListAll", method = RequestMethod.POST)
	@ResponseBody
	@SysLog(text = "查詢全部我的收藏信息", type = LogType.View)
	public ResultRowsVO<MyCollectVO> queryAppVersion(MyCollectVO myCollectVO, PageParamVO pageParam){
	    	UserVO user = SessionInfoUtil.getSessionUserInfo();
	    	myCollectVO.setUserId(user.getUserid());
	    	
		PageInfo<MyCollectVO> listData = myCollectService.queryMyCollect(myCollectVO, pageParam, false);
		List<MyCollectVO> myCollectList = listData.getList();
		return createResultRowsVO(myCollectList, true, "",(int)listData.getTotal());
	}
	
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	@ResponseBody
	@SysLog(text = "新增收藏信息", type = LogType.Add)
	public ResultBasicVO addAppVersion(MyCollectVO myCollectVO){
		boolean result = myCollectService.insertMyCollect(myCollectVO);
		return createResultBasicVO(result, "");
	}
	
	@RequestMapping(value = "/drop", method = RequestMethod.POST)
	@ResponseBody
	@SysLog(text = "删除收藏信息", type = LogType.Edit)
	public ResultBasicVO dropAlarmCode(MyCollectVO myCollectVO) {
	    	UserVO user = SessionInfoUtil.getSessionUserInfo();
		myCollectVO.setUserId(user.getUserid());
		boolean result = myCollectService.deleteMyCollect(myCollectVO);
		return this.createResultBasicVO(result, "");
	}
}

